import request from '@/config/axios'

// 灵境币订单 VO
export interface PointOrderVO {
  id: number // 订单编号
  userId: number // 用户编号
  spuId: number // 商品编号
  spuName: string // 商品名字
  price: number // 价格，单位：分
  payStatus: boolean // 是否已支付：[0:未支付 1:已经支付过]
  payOrderId: number // 支付订单编号
  payChannelCode: string // 支付成功的支付渠道
  payTime: Date // 订单支付时间
  payRefundId: number // 退款订单编号
  refundPrice: number // 退款金额，单位：分
  refundTime: Date // 退款时间
}

// 灵境币订单 API
export const PointOrderApi = {
  // 查询灵境币订单分页
  getPointOrderPage: async (params: any) => {
    return await request.get({ url: `/member/point-order/page`, params })
  },

  // 查询灵境币订单详情
  getPointOrder: async (id: number) => {
    return await request.get({ url: `/member/point-order/get?id=` + id })
  },

  // 新增灵境币订单
  createPointOrder: async (data: PointOrderVO) => {
    return await request.post({ url: `/member/point-order/create`, data })
  },

  // 修改灵境币订单
  updatePointOrder: async (data: PointOrderVO) => {
    return await request.put({ url: `/member/point-order/update`, data })
  },

  // 删除灵境币订单
  deletePointOrder: async (id: number) => {
    return await request.delete({ url: `/member/point-order/delete?id=` + id })
  },

  // 导出灵境币订单 Excel
  exportPointOrder: async (params) => {
    return await request.download({ url: `/member/point-order/export-excel`, params })
  },
}